/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;

init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('nbf', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }

  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model ArrayOutputRequest {
  innput?: {
    request?: string(name='request'),
    requestId?: string(name='requestId'),
  }(name='innput'),
}

model ArrayOutputShrinkRequest {
  innputShrink?: string(name='innput'),
}

model ArrayOutputResponse = {
  headers: map[string]string(name='headers'),
  body: [ string ](name='body'),
}

async function arrayOutput(request: ArrayOutputRequest): ArrayOutputResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return arrayOutputWithOptions(request, headers, runtime);
}

async function arrayOutputWithOptions(tmpReq: ArrayOutputRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ArrayOutputResponse {
  Util.validateModel(tmpReq);
  var request = new ArrayOutputShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.innput)) {
    request.innputShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.innput, 'innput', 'json');
  }
  var query : map[string]any= {};
  if (!Util.isUnset(request.innputShrink)) {
    query.innput = request.innputShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  return doROARequest('ArrayOutput', '2021-08-03_11-25-46-244', 'HTTPS', 'POST', 'AK', `/verification/ArrayOutput`, 'array', req, runtime);
}

model ArrayInputRequest {
  input?: [ string ](name='input'),
}

model ArrayInputShrinkRequest {
  inputShrink?: string(name='input'),
}

model ArrayInputResponseBody = {
  result?: string(name='result'),
  current?: int32(name='current'),
  total?: long(name='total'),
  totalPage?: int32(name='totalPage'),
  success?: boolean(name='success'),
  pageSize?: int32(name='pageSize'),
  errorCode?: string(name='errorCode'),
  bizException?: boolean(name='bizException'),
  errorMsg?: string(name='errorMsg'),
}

model ArrayInputResponse = {
  headers: map[string]string(name='headers'),
  body: ArrayInputResponseBody(name='body'),
}

async function arrayInput(request: ArrayInputRequest): ArrayInputResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return arrayInputWithOptions(request, headers, runtime);
}

async function arrayInputWithOptions(tmpReq: ArrayInputRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ArrayInputResponse {
  Util.validateModel(tmpReq);
  var request = new ArrayInputShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.input)) {
    request.inputShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.input, 'input', 'json');
  }
  var query : map[string]any= {};
  if (!Util.isUnset(request.inputShrink)) {
    query.input = request.inputShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  return doROARequest('ArrayInput', '2021-08-03_11-25-46-244', 'HTTPS', 'POST', 'AK', `/verification/ArrayInput`, 'json', req, runtime);
}

model SingleComplexRequest {
  input?: {
    stringValue?: string(name='stringValue'),
    intValue?: int32(name='intValue'),
    booleanValue?: boolean(name='booleanValue'),
    integerValue?: int32(name='integerValue'),
    longValue?: long(name='longValue'),
    secondInput?: {
      secondString?: readable(name='secondString'),
      thirdList?: [ 
        {
          thirdInt?: int32(name='thirdInt'),
          thirdString?: readable(name='thirdString'),
        }
      ](name='thirdList'),
      secondInt?: int32(name='secondInt'),
    }(name='secondInput'),
  }(name='input'),
}

model SingleComplexShrinkRequest {
  inputShrink?: string(name='input'),
}

model SingleComplexResponseBody = {
  stringValue?: readable(name='stringValue'),
  secondOutput?: {
    secondString?: readable(name='secondString'),
    thirdList?: [ 
      {
        thirdInt?: int32(name='thirdInt'),
        thirdString?: readable(name='thirdString'),
      }
    ](name='thirdList'),
    secondInt?: int32(name='secondInt'),
  }(name='secondOutput'),
  intValue?: int32(name='intValue'),
  booleanValue?: boolean(name='booleanValue'),
  integerValue?: int32(name='integerValue'),
  longValue?: long(name='longValue'),
}

model SingleComplexResponse = {
  headers: map[string]string(name='headers'),
  body: SingleComplexResponseBody(name='body'),
}

async function singleComplex(request: SingleComplexRequest): SingleComplexResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return singleComplexWithOptions(request, headers, runtime);
}

async function singleComplexWithOptions(tmpReq: SingleComplexRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SingleComplexResponse {
  Util.validateModel(tmpReq);
  var request = new SingleComplexShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.input)) {
    request.inputShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.input, 'input', 'json');
  }
  var query : map[string]any= {};
  if (!Util.isUnset(request.inputShrink)) {
    query.input = request.inputShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  return doROARequest('SingleComplex', '2021-08-03_11-25-46-244', 'HTTPS', 'POST', 'AK', `/verification/SingleComplex`, 'json', req, runtime);
}

model PrimitiveInputIntRequest {
  input?: int32(name='input'),
}

model PrimitiveInputIntResponseBody = {
  result?: int32(name='result'),
  current?: int32(name='current'),
  total?: long(name='total'),
  totalPage?: int32(name='totalPage'),
  success?: boolean(name='success'),
  pageSize?: int32(name='pageSize'),
  errorCode?: readable(name='errorCode'),
  bizException?: boolean(name='bizException'),
  errorMsg?: readable(name='errorMsg'),
}

model PrimitiveInputIntResponse = {
  headers: map[string]string(name='headers'),
  body: PrimitiveInputIntResponseBody(name='body'),
}

async function primitiveInputInt(request: PrimitiveInputIntRequest): PrimitiveInputIntResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return primitiveInputIntWithOptions(request, headers, runtime);
}

async function primitiveInputIntWithOptions(request: PrimitiveInputIntRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PrimitiveInputIntResponse {
  Util.validateModel(request);
  var query : map[string]any= {};
  if (!Util.isUnset(request.input)) {
    query.input = request.input;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  return doROARequest('PrimitiveInputInt', '2021-08-03_11-25-46-244', 'HTTPS', 'POST', 'AK', `/verification/PrimitiveInputInt`, 'json', req, runtime);
}

model PrimitiveOutputStringRequest {
  input?: {
    request?: string(name='request'),
    requestId?: string(name='requestId'),
  }(name='input'),
}

model PrimitiveOutputStringShrinkRequest {
  inputShrink?: string(name='input'),
}

model PrimitiveOutputStringResponse = {
  headers: map[string]string(name='headers'),
  body: string(name='body'),
}

async function primitiveOutputString(request: PrimitiveOutputStringRequest): PrimitiveOutputStringResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return primitiveOutputStringWithOptions(request, headers, runtime);
}

async function primitiveOutputStringWithOptions(tmpReq: PrimitiveOutputStringRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PrimitiveOutputStringResponse {
  Util.validateModel(tmpReq);
  var request = new PrimitiveOutputStringShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.input)) {
    request.inputShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.input, 'input', 'json');
  }
  var query : map[string]any= {};
  if (!Util.isUnset(request.inputShrink)) {
    query.input = request.inputShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  return doROARequest('PrimitiveOutputString', '2021-08-03_11-25-46-244', 'HTTPS', 'POST', 'AK', `/verification/PrimitiveOutputString`, 'string', req, runtime);
}

model MultiComplexRequest {
  agr0?: string(name='agr0'),
  arg1?: int32(name='arg1'),
  arg2?: {
    stringValue?: string(name='stringValue'),
    intValue?: int32(name='intValue'),
    booleanValue?: boolean(name='booleanValue'),
    integerValue?: int32(name='integerValue'),
    longValue?: long(name='longValue'),
    secondInput?: {
      secondString?: string(name='secondString'),
      thirdList?: [ 
        {
          thirdInt?: int32(name='thirdInt'),
          thirdString?: readable(name='thirdString'),
        }
      ](name='thirdList'),
      secondInt?: int32(name='secondInt'),
    }(name='secondInput'),
  }(name='arg2'),
}

model MultiComplexShrinkRequest {
  agr0?: string(name='agr0'),
  arg1?: int32(name='arg1'),
  arg2Shrink?: string(name='arg2'),
}

model MultiComplexResponseBody = {
  stringValue?: string(name='stringValue'),
  secondOutput?: {
    secondString?: string(name='secondString'),
    thirdList?: [ 
      {
        thirdInt?: int32(name='thirdInt'),
        thirdString?: string(name='thirdString'),
      }
    ](name='thirdList'),
    secondInt?: int32(name='secondInt'),
  }(name='secondOutput'),
  intValue?: int32(name='intValue'),
  booleanValue?: boolean(name='booleanValue'),
  integerValue?: int32(name='integerValue'),
  longValue?: long(name='longValue'),
}

model MultiComplexResponse = {
  headers: map[string]string(name='headers'),
  body: MultiComplexResponseBody(name='body'),
}

async function multiComplex(request: MultiComplexRequest): MultiComplexResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return multiComplexWithOptions(request, headers, runtime);
}

async function multiComplexWithOptions(tmpReq: MultiComplexRequest, headers: map[string]string, runtime: Util.RuntimeOptions): MultiComplexResponse {
  Util.validateModel(tmpReq);
  var request = new MultiComplexShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.arg2)) {
    request.arg2Shrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.arg2, 'arg2', 'json');
  }
  var query : map[string]any= {};
  if (!Util.isUnset(request.agr0)) {
    query.agr0 = request.agr0;
  }
  if (!Util.isUnset(request.arg1)) {
    query.arg1 = request.arg1;
  }
  if (!Util.isUnset(request.arg2Shrink)) {
    query.arg2 = request.arg2Shrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  return doROARequest('MultiComplex', '2021-08-03_11-25-46-244', 'HTTPS', 'POST', 'AK', `/verification/MultiComplex`, 'json', req, runtime);
}

model PrimitiveInputBooleanRequest {
  query?: boolean(name='query'),
}

model PrimitiveInputBooleanResponseBody = {
  result?: boolean(name='result'),
  current?: int32(name='current'),
  total?: long(name='total'),
  totalPage?: int32(name='totalPage'),
  success?: boolean(name='success'),
  pageSize?: int32(name='pageSize'),
  errorCode?: string(name='errorCode'),
  bizException?: boolean(name='bizException'),
  errorMsg?: string(name='errorMsg'),
}

model PrimitiveInputBooleanResponse = {
  headers: map[string]string(name='headers'),
  body: PrimitiveInputBooleanResponseBody(name='body'),
}

async function primitiveInputBoolean(request: PrimitiveInputBooleanRequest): PrimitiveInputBooleanResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return primitiveInputBooleanWithOptions(request, headers, runtime);
}

async function primitiveInputBooleanWithOptions(request: PrimitiveInputBooleanRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PrimitiveInputBooleanResponse {
  Util.validateModel(request);
  var query : map[string]any= {};
  if (!Util.isUnset(request.query)) {
    query.query = request.query;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  return doROARequest('PrimitiveInputBoolean', '2021-08-03_11-25-46-244', 'HTTPS', 'POST', 'AK', `/verification/PrimitiveInputBoolean`, 'json', req, runtime);
}

model VoidOutputRequest {
  input?: {
    request?: string(name='request'),
    requestId?: string(name='requestId'),
  }(name='input'),
}

model VoidOutputShrinkRequest {
  inputShrink?: string(name='input'),
}

model VoidOutputResponse = {
  headers: map[string]string(name='headers'),
  body: object(name='body'),
}

async function voidOutput(request: VoidOutputRequest): VoidOutputResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return voidOutputWithOptions(request, headers, runtime);
}

async function voidOutputWithOptions(tmpReq: VoidOutputRequest, headers: map[string]string, runtime: Util.RuntimeOptions): VoidOutputResponse {
  Util.validateModel(tmpReq);
  var request = new VoidOutputShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.input)) {
    request.inputShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.input, 'input', 'json');
  }
  var query : map[string]any= {};
  if (!Util.isUnset(request.inputShrink)) {
    query.input = request.inputShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  return doROARequest('VoidOutput', '2021-08-03_11-25-46-244', 'HTTPS', 'POST', 'AK', `/verification/VoidOutput`, 'json', req, runtime);
}

model PrimitiveOutputIntegerRequest {
  input?: {
    request?: int32(name='request'),
    requestId?: string(name='requestId'),
  }(name='input'),
}

model PrimitiveOutputIntegerShrinkRequest {
  inputShrink?: string(name='input'),
}

model PrimitiveOutputIntegerResponse = {
  headers: map[string]string(name='headers'),
  body: int32(name='body'),
}

async function primitiveOutputInteger(request: PrimitiveOutputIntegerRequest): PrimitiveOutputIntegerResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return primitiveOutputIntegerWithOptions(request, headers, runtime);
}

async function primitiveOutputIntegerWithOptions(tmpReq: PrimitiveOutputIntegerRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PrimitiveOutputIntegerResponse {
  Util.validateModel(tmpReq);
  var request = new PrimitiveOutputIntegerShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.input)) {
    request.inputShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.input, 'input', 'json');
  }
  var query : map[string]any= {};
  if (!Util.isUnset(request.inputShrink)) {
    query.input = request.inputShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  return doROARequest('PrimitiveOutputInteger', '2021-08-03_11-25-46-244', 'HTTPS', 'POST', 'AK', `/verification/PrimitiveOutputInteger`, 'int32', req, runtime);
}

model PrimitiveOutputBooleanRequest {
  input?: {
    request?: boolean(name='request'),
    requestId?: readable(name='requestId'),
  }(name='input'),
}

model PrimitiveOutputBooleanShrinkRequest {
  inputShrink?: string(name='input'),
}

model PrimitiveOutputBooleanResponse = {
  headers: map[string]string(name='headers'),
  body: boolean(name='body'),
}

async function primitiveOutputBoolean(request: PrimitiveOutputBooleanRequest): PrimitiveOutputBooleanResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return primitiveOutputBooleanWithOptions(request, headers, runtime);
}

async function primitiveOutputBooleanWithOptions(tmpReq: PrimitiveOutputBooleanRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PrimitiveOutputBooleanResponse {
  Util.validateModel(tmpReq);
  var request = new PrimitiveOutputBooleanShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.input)) {
    request.inputShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.input, 'input', 'json');
  }
  var query : map[string]any= {};
  if (!Util.isUnset(request.inputShrink)) {
    query.input = request.inputShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  return doROARequest('PrimitiveOutputBoolean', '2021-08-03_11-25-46-244', 'HTTPS', 'POST', 'AK', `/verification/PrimitiveOutputBoolean`, 'boolean', req, runtime);
}

model PrimitiveInputStringRequest {
  input?: string(name='input'),
}

model PrimitiveInputStringResponseBody = {
  result?: string(name='result'),
  current?: int32(name='current'),
  total?: long(name='total'),
  totalPage?: int32(name='totalPage'),
  success?: boolean(name='success'),
  pageSize?: int32(name='pageSize'),
  errorCode?: string(name='errorCode'),
  bizException?: boolean(name='bizException'),
  errorMsg?: string(name='errorMsg'),
}

model PrimitiveInputStringResponse = {
  headers: map[string]string(name='headers'),
  body: PrimitiveInputStringResponseBody(name='body'),
}

async function primitiveInputString(request: PrimitiveInputStringRequest): PrimitiveInputStringResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return primitiveInputStringWithOptions(request, headers, runtime);
}

async function primitiveInputStringWithOptions(request: PrimitiveInputStringRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PrimitiveInputStringResponse {
  Util.validateModel(request);
  var query : map[string]any= {};
  if (!Util.isUnset(request.input)) {
    query.input = request.input;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  return doROARequest('PrimitiveInputString', '2021-08-03_11-25-46-244', 'HTTPS', 'POST', 'AK', `/verification/PrimitiveInputString`, 'json', req, runtime);
}

